package com.yc.yyds.biz;

import com.yc.yyds.dao.DanmuDao;

import java.util.List;
import java.util.Map;

public class DanmuBiz {
    DanmuDao dao = new DanmuDao();
    //查询
    public List<Map<String, Object>> query(String movieid) throws BizException {
        if (movieid.equals("")){
            throw new BizException("业务异常,请联系管理员");
        }
        return dao.query(movieid);
    }
    //保存
    public void save(String userid,String movieid,String content) throws BizException {
        if (userid.isEmpty()){
            throw new BizException("请登录后再发送弹幕");
        }
        if (content.equals("")){
            throw new BizException("弹幕内容不能为空");
        }
        if (movieid==null){
            throw new BizException("业务异常,请联系管理员");
        }
        dao.save(userid, movieid, content);
    }
    //数量
    public long num(String movieid) throws BizException {
        if (movieid==null){
            throw new BizException("业务异常");
        }
       return dao.num(movieid);
    }
}
